/*
 * MIT License
 *
 * Copyright (c) 2025 Mark·虎
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 *
 */

package com.hsxxherp.key.support.sys.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.hsxxherp.key.common.annotation.TreeChildren;
import com.hsxxherp.key.common.annotation.TreeId;
import com.hsxxherp.key.common.annotation.TreeParentId;
import io.swagger.v3.oas.annotations.media.Schema;

import java.util.Date;
import java.util.List;

/**
 * 模块注册
 *
 * @author Mark·虎克（2486970363@qq.com）
 */
@TableName("sys_module")
public class SysModule {
    @TableId(value = "pk_application_module", type = IdType.ASSIGN_ID)
    @Schema(description = "应用模块主键，唯一标识每个应用模块", example = "1")
    @TreeId
    private String pkModule;

    @Schema(description = "应用模块的名称，用于标识模块", example = "用户管理模块")
    private String moduleName;

    @Schema(description = "应用模块的内码，唯一标识模块，不可重复", example = "00010001")
    private String innercode;

    @Schema(description = "父模块的主键，若为一级模块则该字段为空", example = "1")
    @TreeParentId
    private Long pkParent;

    @Schema(description = "应用模块的详细描述信息", example = "该模块主要负责用户信息的管理")
    private String description;

    @Schema(description = "应用模块的创建时间", example = "2024-01-01 12:00:00")
    private Date createdAt;

    @Schema(description = "应用模块的更新时间", example = "2024-01-02 13:00:00")
    private Date updatedAt;

    @Schema(description = "子模块列表")
    @TableField(exist = false)
    @TreeChildren
    private List<SysModule> children;

    public String getPkModule() {
        return pkModule;
    }

    public void setPkModule(String pkModule) {
        this.pkModule = pkModule;
    }

    public String getModuleName() {
        return moduleName;
    }

    public void setModuleName(String moduleName) {
        this.moduleName = moduleName;
    }

    public String getInnercode() {
        return innercode;
    }

    public void setInnercode(String innercode) {
        this.innercode = innercode;
    }

    public Long getPkParent() {
        return pkParent;
    }

    public void setPkParent(Long pkParent) {
        this.pkParent = pkParent;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public Date getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(Date updatedAt) {
        this.updatedAt = updatedAt;
    }

    public List<SysModule> getChildren() {
        return children;
    }

    public void setChildren(List<SysModule> children) {
        this.children = children;
    }
}